﻿using System;
using System.Web.UI;
using JQuery.WebKit.Base;
using JQuery.WebKit.WebCommon;
using JQuery.WebKit.WebCommon.Attributes;

#region resources
[assembly: WebResource("JQuery.WebKit.JFooter.JFooter.js", "text/javascript")]
[assembly: WebResource("JQuery.WebKit.JFooter.JFooter.min.js", "text/javascript")]
#endregion

namespace JQuery.WebKit
{
    public class JFooter : WebControlBase
    {
        [JavaScript("zIndex", Category = "options")]
        public int ZIndex
        {
            get;
            set;
        }

        public JFooter()
            : base(System.Web.UI.HtmlTextWriterTag.Div)
        {

        }

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            base.RegisterJQueryResource("JQuery.WebKit.JFooter.JFooter.js");

            //string script = string.Format("$(document).ready(function() {{ $('#{0}').footer({1}); }});", this.ClientID, this.GetJSProperties("options"));
            string script = string.Format("$('#{0}').footer({1});", this.ClientID, this.GetJSProperties("options"));
            this.Page.Resources.Add(new WebScriptResource(typeof(JFooter), this.ClientID, ResourceType.Javascript, script, LoadEvent.DocumentReady));
        }
    }
}
